package day06;

public class MyStack {
	private String[] data;			//保存数据的数组
	private int count;          //当前元素个数
	
	public MyStack(int size){
		data=new String[size];
		count=0;		
	}
	
	public boolean push(String s){
		if(count==data.length){
			return false;
		}
		data[count]=s;
		count++;
		return true;
	}
	
	public String pop(){
		if(count==0){
			return null;
		}
		count--;
		return data[count];
	}
	
	public String toString(){
		String str="";
		for(int i=0; i<count; i++){
			str=str+data[i]+",";//   str+=data[i]+","
		}
		return str;
		
	}
	
}